<?php

class Users_Form_Register extends Zend_Form {

	public function init() {
		$this->setMethod('post');
		
		$username = $this->createElement('text', 'username');
		$username->setLabel(_('Логин:'));
		$username->setAttrib('size','32');
		$username->setAttrib('maxlength','255');
		$username->setRequired(true);
		$username->addValidator(new ZFEngine_Validate_Doctrine_NoRecordExist('Users_Model_Users','username'),true);
		
		$password = $this->createElement('password', 'password');
		$password->setLabel(_('Пароль:'));
		$password->setAttrib('size','32');
		$password->setAttrib('maxlength','255');
		$password->setRequired(true);
		
		$confirm = $this->createElement('password', 'confirm');
		$confirm->setLabel(_('Повторите пароль:'));
		$confirm->setAttrib('size','32');
		$confirm->setAttrib('maxlength','255');
		$confirm->setRequired(true);
		$confirm->addValidator(new ZFEngine_Validate_InputEquals('password'), true);
		
		$email = $this->createElement('text','email');
		$email->setLabel(_('Email:'));
		$email->setAttrib('size','32');
		$email->setAttrib('maxlength','255');
		$email->addValidator('EmailAddress', true);
		$email->setRequired(true);
		$email->addValidator(new ZFEngine_Validate_Doctrine_NoRecordExist('Users_Model_Users','email'),true);
		
		$submit = $this->createElement('submit', 'submit');
		$submit->setLabel(_('Регистрация'));
		
		$this->addElements(array($username,$password,$confirm,$email,$submit));
	}
}